package autopeople.domain.auto;

import javax.persistence.Embedded;
import javax.persistence.Table;

import autopeople.domain.entity.Entity;

@Table(name = "AUTO")
@javax.persistence.Entity
public abstract class Auto extends Entity {

	protected Auto() {
		super();
	}

	public Auto(Engine engine, WheelsType wheels) {
		super();
		this.engine = engine;
		this.setWheels(wheels);
	}

	@Embedded
	private Engine engine;

	// TODO rune.forberg Should persist as ENUM in database in separate table
	// at least this is better than storing int value
	private String wheels;

	public void setEngine(Engine engine) {
		this.engine = engine;
	}

	public Engine getEngine() {
		return engine;
	}

	public void setWheels(WheelsType wheels) {
		this.wheels = wheels.toString();
	}

	public String getWheels() {
		return wheels;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + " " + getEngine().getSize() + " "
				+ getWheels().toString();
	}

}
